package com.sun.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sun.mapper.OneLMapper;
import com.sun.mapper.ScoreMapper;
import com.sun.mapper.ScoreWMapper;
import com.sun.pojo.HeannScoreL;
import com.sun.pojo.HeannScoreW;
import com.sun.pojo.OneByOneL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class OneController {


    @Autowired
    private OneLMapper oneLMapper;
/*
    @Autowired
    private ScoreWMapper scoreWMapper;
*/




    /*
    * 理科
    * */
    @RequestMapping("/onel/{pageNo}")
    public Object page(@PathVariable("pageNo") Integer pageNo,
                       @RequestParam(value = "onel",defaultValue = "onel")  String one,
                       @RequestParam(value = "one",defaultValue = "one")  String one1,
                       @RequestParam(value = "onel",defaultValue = "onel")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                       Model model
    ) {
        PageHelper.startPage(pageNo,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllL();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }


    @RequestMapping("/onel20/{pageNo}")
    public Object page20(@PathVariable("pageNo") Integer pageNo,
                       @RequestParam(value = "onel",defaultValue = "onel")  String one,
                       @RequestParam(value = "one20",defaultValue = "one20")  String one1,
                       @RequestParam(value = "onel20",defaultValue = "onel20")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                       Model model
    ) {
        PageHelper.startPage(pageNo,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllL20();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }

    @RequestMapping("/onel20")
    public Object p20(@RequestParam(value = "pageNo1",defaultValue = "0") Integer pageNo1,
                         @RequestParam(value = "onel",defaultValue = "onel")  String one,
                         @RequestParam(value = "one20",defaultValue = "one20")  String one1,
                         @RequestParam(value = "onel20",defaultValue = "onel20")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                         Model model
    ) {
        PageHelper.startPage(pageNo1,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllL20();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }

    @RequestMapping("/onel19/{pageNo}")
    public Object page19(@PathVariable("pageNo") Integer pageNo,
                         @RequestParam(value = "onel",defaultValue = "onel")  String one,
                         @RequestParam(value = "one19",defaultValue = "one19")  String one1,
                         @RequestParam(value = "onel19",defaultValue = "onel19")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                         Model model
    ) {
        PageHelper.startPage(pageNo,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllL19();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }

    @RequestMapping("/onel19")
    public Object p19(@RequestParam(value = "pageNo1",defaultValue = "0") Integer pageNo1,
                         @RequestParam(value = "onel",defaultValue = "onel")  String one,
                         @RequestParam(value = "one19",defaultValue = "one19")  String one1,
                         @RequestParam(value = "onel19",defaultValue = "onel19")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                         Model model
    ) {
        PageHelper.startPage(pageNo1,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllL19();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }

    @RequestMapping("/onel")
    public String po(@RequestParam(value = "pageNo1",defaultValue = "0") Integer pageNo1,
                     @RequestParam(value = "onel",defaultValue = "onel")  String one,
                     @RequestParam(value = "one",defaultValue = "one")  String one1,
                     @RequestParam(value = "onel",defaultValue = "onel")  String one2,
                     Model model){
        PageHelper.startPage(pageNo1,10);
        List<OneByOneL> list = oneLMapper.selectAllL();
        PageInfo<OneByOneL> page1 = new PageInfo<>(list,5);
        model.addAttribute("list",page1);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);

        return "one/list";
    }


    @RequestMapping("/grade/onel")
    public String p1o(@RequestParam(value = "name",defaultValue = "0") Integer name,
                     @RequestParam(value = "onel",defaultValue = "onel")  String one,
                     @RequestParam(value = "one",defaultValue = "one")  String one1,
                     @RequestParam(value = "onel",defaultValue = "onel")  String one2,
                     Model model){
        List<OneByOneL> list = oneLMapper.selectByGrade(name);
        PageInfo<OneByOneL> page1 = new PageInfo<>(list,5);
        model.addAttribute("list",page1);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);

        return "one/list";
    }
    @RequestMapping("/grade/onel20")
    public String p2o(@RequestParam(value = "name",defaultValue = "0") Integer name,
                      @RequestParam(value = "onel",defaultValue = "onel")  String one,
                      @RequestParam(value = "one20",defaultValue = "one20")  String one1,
                      @RequestParam(value = "onel20",defaultValue = "onel20")  String one2,
                      Model model){
        List<OneByOneL> list = oneLMapper.selectByGradel20(name);
        PageInfo<OneByOneL> page1 = new PageInfo<>(list,5);
        model.addAttribute("list",page1);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);

        return "one/list";
    }
    @RequestMapping("/grade/onel19")
    public String p3o(@RequestParam(value = "name",defaultValue = "0") Integer name,
                      @RequestParam(value = "onel",defaultValue = "onel")  String one,
                      @RequestParam(value = "one19",defaultValue = "one19")  String one1,
                      @RequestParam(value = "onel19",defaultValue = "onel19")  String one2,
                      Model model){
        List<OneByOneL> list = oneLMapper.selectByGradel19(name);
        PageInfo<OneByOneL> page1 = new PageInfo<>(list,5);
        model.addAttribute("list",page1);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);

        return "one/list";
    }

    @RequestMapping("/grade/onew")
    public String p1w(@RequestParam(value = "name",defaultValue = "0") Integer name,
                      @RequestParam(value = "onew",defaultValue = "onew")  String one,
                      @RequestParam(value = "one",defaultValue = "one")  String one1,
                      @RequestParam(value = "onew",defaultValue = "onew")  String one2,
                      Model model){
        List<OneByOneL> list = oneLMapper.selectByGradew(name);
        PageInfo<OneByOneL> page1 = new PageInfo<>(list,5);
        model.addAttribute("list",page1);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);

        return "one/list";
    }
    @RequestMapping("/grade/onew20")
    public String p2w(@RequestParam(value = "name",defaultValue = "0") Integer name,
                      @RequestParam(value = "onew",defaultValue = "onew")  String one,
                      @RequestParam(value = "one20",defaultValue = "one20")  String one1,
                      @RequestParam(value = "onew20",defaultValue = "onew20")  String one2,
                      Model model){
        List<OneByOneL> list = oneLMapper.selectByGradew20(name);
        PageInfo<OneByOneL> page1 = new PageInfo<>(list,5);
        model.addAttribute("list",page1);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);

        return "one/list";
    }
    @RequestMapping("/grade/onew19")
    public String p3w(@RequestParam(value = "name",defaultValue = "0") Integer name,
                      @RequestParam(value = "onew",defaultValue = "onew")  String one,
                      @RequestParam(value = "one19",defaultValue = "one19")  String one1,
                      @RequestParam(value = "onew19",defaultValue = "onew19")  String one2,
                      Model model){
        List<OneByOneL> list = oneLMapper.selectByGradew19(name);
        PageInfo<OneByOneL> page1 = new PageInfo<>(list,5);
        model.addAttribute("list",page1);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);

        return "one/list";
    }






    /*
     * 文科
     * */
    @RequestMapping("/onew/{pageNo}")
    public Object pageW(@PathVariable("pageNo") Integer pageNo,
                       @RequestParam(value = "onew",defaultValue = "onew")  String one,
                       @RequestParam(value = "one",defaultValue = "one")  String one1,
                        @RequestParam(value = "onew",defaultValue = "onew")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                       Model model
    ) {
        PageHelper.startPage(pageNo,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllW();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }

    @RequestMapping("/onew")
    public Object pW(@RequestParam(value = "pageNo1",defaultValue = "0") Integer pageNo1,
                        @RequestParam(value = "onew",defaultValue = "onew")  String one,
                        @RequestParam(value = "one",defaultValue = "one")  String one1,
                        @RequestParam(value = "onew",defaultValue = "onew")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                        Model model
    ) {
        PageHelper.startPage(pageNo1,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllW();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }


    @RequestMapping("/onew20/{pageNo}")
    public Object pageW20(@PathVariable("pageNo") Integer pageNo,
                         @RequestParam(value = "onew",defaultValue = "onew")  String one,
                         @RequestParam(value = "one20",defaultValue = "one20")  String one1,
                          @RequestParam(value = "onew20",defaultValue = "onew20")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                         Model model
    ) {
        PageHelper.startPage(pageNo,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllW20();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }

    @RequestMapping("/onew20")
    public Object paW20(@RequestParam(value = "pageNo1",defaultValue = "0") Integer pageNo1,
                          @RequestParam(value = "onew",defaultValue = "onew")  String one,
                          @RequestParam(value = "one20",defaultValue = "one20")  String one1,
                          @RequestParam(value = "onew20",defaultValue = "onew20")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                          Model model
    ) {
        PageHelper.startPage(pageNo1,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllW20();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }


    @RequestMapping("/onew19/{pageNo}")
    public Object pageW19(@PathVariable("pageNo") Integer pageNo,
                          @RequestParam(value = "onew",defaultValue = "onew")  String one,
                          @RequestParam(value = "one19",defaultValue = "one19")  String one1,
                          @RequestParam(value = "onew19",defaultValue = "onew19")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                          Model model
    ) {
        PageHelper.startPage(pageNo,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllW19();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }

    @RequestMapping("/onew19")
    public Object paW19(@RequestParam(value = "pageNo1",defaultValue = "0") Integer pageNo1,
                          @RequestParam(value = "onew",defaultValue = "onew")  String one,
                          @RequestParam(value = "one19",defaultValue = "one19")  String one1,
                          @RequestParam(value = "onew19",defaultValue = "onew19")  String one2,
//                       @RequestParam(value = "year",defaultValue = "2021")  Integer year,
                          Model model
    ) {
        PageHelper.startPage(pageNo1,10);
//        List<HeannScoreL> list = scoreMapper.selectByYear(year);
        List<OneByOneL> list = oneLMapper.selectAllW19();
        PageInfo<OneByOneL> page = new PageInfo<>(list,5);
        model.addAttribute("list",page);
        model.addAttribute("one",one);
        model.addAttribute("one1",one1);
        model.addAttribute("one2",one2);
        return "one/list";
    }


}
